package com.hr.leetcode.位运算;

/**
 * @author 周恒哲
 * @date 2020/05/28
 **/
public class _231_2的幂 {
    public static boolean isPowerOfTwo(int n) {
        if (n == 0) return false;
        while (n % 2 == 0) {
            n /= 2;
        }
        return n == 1;
    }

    public static void main(String[] args) {
        _231_2的幂.isPowerOfTwo(4);
    }
}
